package edu.cuit.zhuyimeng.flight.controller.dto;

import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonIgnore;
import edu.cuit.zhuyimeng.framework.common.enums.GenericPatterns;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * 创建航班DTO
 */
@Schema(name = "CreateFlightDTO", description = "创建航班DTO")
@Data
public class CreateFlightDTO implements Serializable {

    /**
     * 航班号
     */
    @Schema(name = "number", description = "航班号")
    @Pattern(regexp = GenericPatterns.FLIGHT_NUMBER, message = "航班号格式错误")
    private String number;

    /**
     * 飞机id
     */
    @Schema(name = "aircraftId", description = "飞机id")
    @NotNull( message = "飞机id不能为空")
    private Long aircraftId;

    /**
     * 起飞时间
     */
    @Schema(name = "startTime", description = "起飞时间")
    @NotNull(message = "起飞时间不能为空")
    private Date startTime;

    /**
     * 到达时间
     */
    @Schema(name = "endTime", description = "到达时间")
    @NotNull(message = "到达时间不能为空")
    private Date endTime;

    /**
     * 出发城市
     */
    @Schema(name = "deployCity", description = "出发城市")
    @NotBlank(message = "出发城市不能为空")
    private String deployCity;

    /**
     * 到达城市
     */
    @Schema(name = "arrivalCity", description = "到达城市")
    @NotBlank(message = "目的城市不能为空")
    private String arrivalCity;

    /**
     * 订票开始时间
     */
    @Schema(name = "startBook", description = "订票开始时间")
    @NotNull(message = "订票开始时间不能为空")
    private Date startBook;

    /**
     * 订票结束时间
     */
    @Schema(name = "endBook", description = "订票结束时间")
    @NotNull(message = "订票结束时间不能为空")
    private Date endBook;

    /**
     * 价格
     */
    @Schema(name = "price", description = "价格")
    @NotNull(message = "价格不能为空")
    private Integer price;

    /**
     * 逻辑删除
     */
    @Schema(hidden = true)
    @TableLogic
    @JsonIgnore
    private Integer deleted;

    @Serial
    private static final long serialVersionUID = 1L;

}
